/**
 * $Revision: 1.0 $
 * $Author: Geln Yang $
 * $Date: Sep 5, 2010 11:03:52 AM $
 *
 * Author: Geln Yang
 * Date  : Sep 5, 2010 11:03:52 AM
 *
 */
package com.gooex.domain.common;

import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;

/**
 * @author Geln Yang
 * @version 1.0
 */
public class SubscriptionUtil {

	public static String[] getTodayInterval() {
		List<String> intervals = new ArrayList<String>();

		intervals.add("1");
		Date date = getCurrentDate();
		Calendar calendar = Calendar.getInstance();
		calendar.setTime(date);
		int dayOfWeek = calendar.get(Calendar.DAY_OF_WEEK);
		dayOfWeek++;
		if (dayOfWeek > 7)
			dayOfWeek = 1;

		intervals.add(dayOfWeek + "/7");
		int dayOfMonth = calendar.get(Calendar.DAY_OF_MONTH);
		intervals.add(dayOfMonth + "/31");
		return intervals.toArray(new String[] {});
	}

	protected static Date getCurrentDate() {
		return new Date();
	}
}
